﻿// This software is the confidential and proprietary information of NetBay.
// Such confidential information should not be disclosed.
// NetBay copyright(c) 2012

#region

using System;
using Rio.Workflow.Runtime.Interop;

#endregion

namespace Rio.Workflow.Runtime
{
    internal class WorkflowFactory
    {
        #region Class Methods

        /// <summary>
        /// Gets an instance of the specified type in the assembly.
        /// </summary>
        /// <param name="assembly">Assembly name.</param>
        /// <param name="typename">Full type name.</param>
        /// <returns></returns>
        public static WorkflowContextBase GetInstance(string assembly, string typename)
        {
            return WorkflowActivator.CreateInstance<WorkflowContextBase>(assembly, typename);
        }

        /// <summary>
        /// Gets an instance of the specified type
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public static WorkflowContextBase GetInstance(Type type)
        {
            return WorkflowActivator.CreateInstance<WorkflowContextBase>(type);
        }

        /// <summary>
        /// Gets the instance.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        /// <param name="typename">The typename.</param>
        /// <returns></returns>
        public static T GetInstance<T>(string assembly, string typename)
        {
            return WorkflowActivator.CreateInstance<T>(assembly, typename);
        }

        /// <summary>
        /// Gets the instance.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public static T GetInstance<T>(Type type)
        {
            return WorkflowActivator.CreateInstance<T>(type);
        }

        #endregion
    }
}